package org.leno.common.util;

import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.beanutils.BeanUtils;
import org.leno.houseHire.service.HouseDTO;
import org.leno.houseHire.service.HouseSmallDTO;

public class MyCollectionUtils {

	public static void copy(Collection<HouseSmallDTO> tarCollection,Collection<HouseDTO> srcCollection){
		Iterator<HouseDTO> it = srcCollection.iterator();
		while(it.hasNext()){
			HouseSmallDTO smallDTO = new HouseSmallDTO();
			HouseDTO dto = it.next();
			try {
				BeanUtils.copyProperties(smallDTO, dto);
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			tarCollection.add(smallDTO);
		}
	}
}
